<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="app" uri="http://www.wanrenhui.com" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
	  <%@include file="/res/include/base-head.jsp"%>
	  <%@include file="/res/include/jquery-easyui.jsp"%>
	<script type="text/javascript" src="${pageContext.request.contextPath}/res/js/idle/idleBase.js"></script>
  </head>
  <body>
	<div class="easyui-layout" data-options="fit:true">
	    <div data-options="region:'center',border:false">
		    <table id="datagrid" data-options="url:'${pageContext.request.contextPath}/idle/base/list',toolbar:'#toolbar'">
				<thead>
					<tr>
						<th data-options="field:'strUpdAt',width:120,align:'center'">最后修改时间</th>
						<th data-options="field:'strNewAt',width:120,align:'center' ">创建时间</th>
						<th data-options="field:'type',width:80,align:'center',formatter:formatType">交易类型</th>
						<th data-options="field:'content',width:300,align:'center' ">内容</th>
						<th data-options="field:'userNick',width:80,align:'center' ">创建者用户</th>
						<th data-options="field:'communityName',width:80,align:'center' ">社区</th>
						<th data-options="field:'img',width:150,align:'center',formatter:formatImg">图片</th>
						<th data-options="field:'status',width:80,align:'center',formatter:formatStatus">状态</th>
						<th data-options="field:'isShow',width:80,align:'center',formatter:formatShow">是否显示</th>
						<th data-options="field:'pv',width:80,align:'center'">浏览量</th>
						<th data-options="field:'price',width:80,align:'center' ">价格</th>
						<th data-options="field:'title',width:80,align:'center' ">标题</th>
						<th data-options="field:'quantity',width:80,align:'center' ">闲置品数量</th>
			            <th data-options="field:'id',align:'center',width:200,formatter:formatOperation">管理操作</th>
					</tr>
				</thead>
			</table>
	  	</div>
	</div>
	<script>
		 function formatOperation(value,row,index) {
			 var l_html = '';
			if(row.status=="1"){
				l_html += '<a href="javascript:;" class="table_link" onclick="admin.idleBase.unclaimed('+row.id+')">删除</a>';
			}else if(row.status=="2"){
				l_html += '<a href="javascript:;" class="table_link" onclick="admin.idleBase.receive('+row.id+')">取消删除</a>';
			}
			if(row.isShow=="1"){
				l_html += '<a href="javascript:;" class="table_link" onclick="admin.idleBase.myShow('+row.id+')">否</a>';
			}else if(row.isShow=="2"){
				l_html += '<a href="javascript:;" class="table_link" onclick="admin.idleBase.isShow('+row.id+')">是</a>';
			}
			return l_html;
		}
		function formatStatus(value,row,index) {
			var status = row.status;//状态IdelBaseStatusEnum:1-正常;2-删除;3-完成
			if(status=="1"){
				return '正常';
			}else if(status=="2"){
				return '删除';
			}else if(status=="3"){
				return '完成';
			}
		}
		
		function formatShow(value,row,index) {
			var isShow = row.isShow;//是否显示:1-是;2-否
			if (isShow=="1") {
				return '是';
			} else if (isShow=="2") {
				return '否';
			} 
		}
		
		function formatType(type) {
			var l_html = '';//交易类型idleBaseTypeEnum:1-求购;2-私聊;3-一口价
			if(type==1){
				l_html="求购";
			} else if(type==2){
				l_html="私聊";
			} else if(type==3){
				l_html="一口价";
			} 
			return l_html;
		}
		
		
		
		function formatImg(img){
			if(null==img||''==img){
				return "";
			}
			var imgs=img.split(";")
			return '<img style="width:120px;height:120px;" src="http://file.xfquanquan.com'+imgs[0]+'"/>'; 
	    } 
		
	</script>
  </body>
</html>
